package com.wmm.dao.impl;

import com.wmm.dao.ArticleDao;
import com.wmm.domain.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class ArticleDaoImpl implements ArticleDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;


    public void save(Article article) {

        String sql = "insert into t_article values(null,?,?)";

        int update = jdbcTemplate.update(sql, article.getTitle(), article.getContent());
        if (update>0){
            System.out.println("新增成功");
        }else {
            System.out.println("新增失败");
        }

    }
}
